//package com.consul.feign.interceptor;
//
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Enumeration;
//
///**
// * @author zhangbowen
// * @date 2019/4/9写死header得时候可用
// **/
//@Configuration
//public class CustomRequestInterceptor implements RequestInterceptor {
//    @Override
//    public void apply(RequestTemplate requestTemplate) {
//      /*  ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
//        if (attributes != null) {
//            HttpServletRequest request = attributes.getRequest();
//            Enumeration<String> headerNames = request.getHeaderNames();
//            if(headerNames!=null){
//                while (headerNames.hasMoreElements()){
//                    String name=headerNames.nextElement();
//                    String value=request.getHeader(name);
//                    requestTemplate.header(name,value);
//                }
//            }
//        }*/
//        requestTemplate.header("type","1");
//    }
//}
